Skip to content

add a JSON encoder to encode Argument#4

Merged
y1xiaoc merged 3 commits into
deepmodeling:masterfrom
njzjz:json
Jul 27, 2021
Merged

add a JSON encoder to encode Argument#4
y1xiaoc merged 3 commits into
deepmodeling:masterfrom
njzjz:json

Conversation

@njzjz

@njzjz njzjz commented Jul 26, 2021

Copy link
Copy Markdown
Member

Fix #3.

Here is the DeePMD-kit JSON file:
deepmd.txt

@y1xiaoc Please check if any information is missing.

Comment thread dargs/dargs.py
Comment on lines +659 to +678
if isinstance(obj, Argument):
return {
"name": obj.name,
"type": obj.dtype,
"alias": obj.alias,
"doc": obj.doc,
"sub_filed": obj.sub_fields,
"fold_subdoc": obj.fold_subdoc,
"repeat": obj.repeat,
"sub_fields": obj.sub_fields,
"sub_variants": obj.sub_variants,
}
elif isinstance(obj, Variant):
return {
"flag_name": obj.flag_name,
"optional": obj.optional,
"default_tag": obj.default_tag,
"choice_dict": obj.choice_dict,
"doc": obj.doc,
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@y1xiaoc Here please check if any information is missing.

Comment thread dargs/dargs.py Outdated
Comment thread dargs/dargs.py Outdated
@njzjz

njzjz commented Jul 26, 2021

Copy link
Copy Markdown
Member Author

@y1xiaoc, ready to review.

@y1xiaoc y1xiaoc merged commit 468756d into deepmodeling:master Jul 27, 2021
@njzjz njzjz deleted the json branch July 27, 2021 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

export to json

2 participants